package io;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * 将io包下的所有类内容输出到控制台
 */
public class Test3 {
    public static void main(String[] args) throws IOException {
        File dir = new File("./src/main/java/io");
        if(dir.isDirectory()) {
            File[] subs = dir.listFiles();
            for(File sub : subs) {
                FileInputStream fis = new FileInputStream(sub);
                //创建与文件等长的数组
                byte[] data = new byte[(int) sub.length()];
                fis.read(data);
                String str = new String(data, StandardCharsets.UTF_8);
                System.out.println(str);
                fis.close();
            }
        }
    }
}
